//
//  SurnameOfPicInfo.m
//  projectOfTeamSample
//
//  Created by lk on 15/11/18.
//  Copyright © 2015年 liukai. All rights reserved.
//

#import "SurnameOfPicInfo.h"

@implementation SurnameOfPicInfo

- (void)setValue:(id)value forUndefinedKey:(NSString *)key
{
    
    if ([key isEqualToString:@"user"])
    {
        self.name = value[@"name"];
        self.avatar_url = value[@"avatar_url"];
    }
    
    if ([key isEqualToString:@"large_image"])
    {
        // 获取高宽比
        float scale = [value[@"r_height"] intValue] / (float)[value[@"r_width"] intValue];
        self.scale = scale;
        
        // 获取self.picurl
        NSArray *url_list = value[@"url_list"];
        NSDictionary *urlDict = url_list.lastObject;
        self.picurl = urlDict[@"url"];
    }
}

@end
